@model PageVM
@{
    var listUm = Model.Rows as List<UserMessage>;

    ViewData["Title"] = "消息";
}

@Html.Raw(Netnr.QuoteTo.Html("netnrmd.css"))

<div class="container-fluid p-4">
    <div class="row">
        <div class="col-12">
            <h4>@ViewData["title"] @Model.Pag.Total</h4>
        </div>
        @if (listUm.Count == 0)
        {
            <div class="col-12 mb-4">
                <h1 class="text-center my-5 py-5" title="咣">😭</h1>
            </div>
        }
        @foreach (var item in listUm)
        {
            <div class="col-12">
                <hr />

                @switch (item.UmAction)
                {
                    case 2:
                        if (item.UmTriggerUid == 0)
                        {
                            <span class="badge bg-secondary me-2">Guest</span>
                        }
                        else
                        {
                            <a href="/user/id/@item.UmTriggerUid">@item.Spare1</a>
                        }

                        <span class="opacity-75">回复了</span>

                        var page = 1;
                        if (item.UmTargetIndex > 20)
                        {
                            page = (int)Math.Ceiling(Convert.ToDecimal(item.UmTargetIndex) / Convert.ToDecimal(10));
                        }
                        if (page == 1)
                        {
                            <a href="/home/list/@item.UmTargetId#no_@item.UmTargetIndex">@item.Spare3</a>
                        }
                        else
                        {
                            <a href="/home/list/@item.UmTargetId?page=@(page)#no_@item.UmTargetIndex">@item.Spare3</a>
                        }
                        break;
                }
                <span class="opacity-75 mx-2">
                    @VisualFormatService.Duration(item.UmCreateTime.Value)
                </span>
                <a href="/user/delmessage/@item.UmId" class="btn-outline-danger" onclick='return confirm("确定删除？")'>删除</a>
                <div class="mt-2">
                    <div class="markdown-body">
                        @Html.Raw(item.UmContent)
                    </div>
                </div>
            </div>
        }

        <div class="col-12 mt-4">
            <partial name="_PartialPaging" />
        </div>
    </div>
</div>